﻿using cludg.Domain.Environment;
using cludg.Domain.Users;
using FluentNHibernate.Mapping;

namespace cludg.Repository.NHibernate.Config.Environment
{
	public class SettingMap : ClassMap<Setting>
	{
		public SettingMap()
		{
			Table("Settings");
			Not.LazyLoad();
			Cache.ReadWrite();
			Id(x => x.Id).Length(50)
				.GeneratedBy.Custom<Utils.IdentifierGenerator>()
				.Default("");
			Map(x => x.Name).Length(100)
				.Not.Nullable();
			Map(x => x.Description).Length(500);
			Map(x => x.Value)
				.CustomType(typeof(string))
				.Length(500);
			Map(x => x.ChangeDateTime);
			Map(x => x.Scope);
			References(x => x.User)
				.Column("UserId")
				.Not.LazyLoad()
				.Nullable();
		}
	}
}
